<template>
  <div class="findShare">
    <h3 class="title van-ellipsis" v-html="shart.title" @click="goInfo"></h3>
    <div class="content van-multi-ellipsis--l2" @click="goInfo">
      {{ shart.content }}
    </div>
    <div class="bottom">
      <img v-if="shart.cover" :src="$baseUrl + shart.cover" alt="" class="o1" />
      <img v-else src="@/assets/logo.png" alt="" class="o1" />
      <div class="o2">{{ shart.author.nickname }}</div>
      <div class="o3">{{ shart.updated_at | filtersTime }}</div>
      <div class="o4 iconfont">&#xe65b;</div>
      <div class="o5">{{ shart.read }}</div>
      <div class="o6 iconfont" :class="{red:userInfo.starArticles.includes(shart.id)}">&#xe650;</div>
      <div class="o7" :class="{red:userInfo.starArticles.includes(shart.id)}">{{ shart.share }}</div>
    </div>
  </div>
</template>
<script>
// 导入辅助函数
import { mapState } from 'vuex'
export default {
  props: ['shart'],
  computed: {
    ...mapState(['userInfo'])
  },
  data () {
    return {}
  },
  methods: {
    // 点击标题内容跳转到文章页面
    // 动态拼接id,在拼接回跳地址的参数
    goInfo () {
      this.$router.push(
        '/home/shareInfo/' + this.shart.id + '?repath=' + this.$route.fullPath
      )
    }
  }
}
</script>
<style lang="less" scoped>
.findShare {
  padding-bottom: 5px;
  .title {
    font-size: 18px;
    font-family: PingFangSC, PingFangSC-Medium;
    font-weight: 500;
    text-align: left;
    color: #181a39;
    line-height: 22px;
    letter-spacing: 0px;
  }
  .content {
    margin: 10px 0 17px;
    font-size: 13px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: left;
    color: #545671;
    line-height: 18px;
    letter-spacing: 0px;
  }
  .bottom {
    display: flex;
    align-items: center;
    font-size: 12px;
    .o1 {
      width: 22px;
      height: 22px;
      opacity: 1;
      border-radius: 50%;
      margin-right: 10px;
    }
    .o2 {
      flex: 1;
    }
    .o3 {
      margin: 0 10px;
    }
    .o5 {
      margin-right: 5px;
    }
  }
  .red {
    color: red;
  }
}
</style>
